Skip to content

chore(Data/Finsupp): make mapDomain_congr congr#39575

Open
YaelDillies wants to merge 5 commits into
leanprover-community:masterfrom
YaelDillies:map_domain_congr
Open

chore(Data/Finsupp): make mapDomain_congr congr#39575
YaelDillies wants to merge 5 commits into
leanprover-community:masterfrom
YaelDillies:map_domain_congr

Conversation

@YaelDillies

Copy link
Copy Markdown
Contributor

This makes simp stronger. It particular, it breaks some proofs that relied on simp being weak.

From MeanFourier


Open in Gitpod

@github-actions

github-actions Bot commented May 19, 2026

Copy link
Copy Markdown

PR summary f034c03164

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ coe_id
+ mapDomain_fun_comp

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean -- pending)

Computed after the build finishes.


No changes to strong technical debt.

No changes to weak technical debt.

Current commit f034c03164
Reference commit e780b56e92

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions Bot added the t-convex-geometry Affine geometry, cones, simplices label May 19, 2026
@YaelDillies
YaelDillies force-pushed the map_domain_congr branch 4 times, most recently from 8867e7c to 3899098 Compare May 21, 2026 10:54
@YaelDillies YaelDillies added t-data Data (lists, quotients, numbers, etc) and removed t-convex-geometry Affine geometry, cones, simplices labels Jun 27, 2026
@YaelDillies
YaelDillies requested a review from eric-wieser June 28, 2026 12:04
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jul 4, 2026
@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jul 4, 2026
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jul 8, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jul 9, 2026
Comment thread Mathlib/RepresentationTheory/Homological/GroupHomology/Functoriality.lean Outdated

@[simp]
theorem repr_reindex : (b.reindex e).repr x = (b.repr x).mapDomain e :=
theorem repr_reindex : (b.reindex e).repr x = (b.repr x).equivMapDomain e :=

@eric-wieser eric-wieser Jul 15, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What motivated this?

@YaelDillies YaelDillies Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes the simp set more confluent. Otherwise simp fails to prove reindexFinsetRange_repr because the new congr lemma allows it to simplify the inside of the expression further earlier

Comment thread Mathlib/Data/Finsupp/Basic.lean Outdated
Comment on lines +291 to +292
-- The linter complains that `mapDomain_id` can be proved from `mapDomain_fun_id` and `id_eq`
-- but this isn't true (at least within most of mathlib)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't this true? It looks to me like the congr lemma would eta-expand id, which leads to that chain.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I wonder if simp high would be more appropriate to silence the linter)

@YaelDillies YaelDillies Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already tried simp high and simp\d a while ago and neither worked to silence the linter.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on "this isn't true (at least within most of mathlib)"?

@YaelDillies YaelDillies Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@[to_fun mapDomain_fun_id]
lemma mapDomain_id : mapDomain id v = v := sum_single _

/--
info: -- Found 0 errors in 41 declarations (plus 22 automatically generated ones) in the current file with 15 linters


-- All linting checks passed!
-/
#guard_msgs in
#lint

but if I do it with import Mathlib, then it complains. I tried bisecting quickly and I seem to be able to import most of mathlib without complaining

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I misdiagnosed and you are perfectly right. simp\d does silence the linter as expected.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me be clearer; I think that perhaps this lemma should not be tagged simp at all, precisely for the reason that the linter says? What proofs break if this is not simp?

Comment thread Mathlib/RepresentationTheory/Intertwining.lean Outdated

@joneugster joneugster left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM!

maintainer merge

@github-actions

Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by joneugster.

@mathlib-triage mathlib-triage Bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Jul 17, 2026
@Vierkantor

Copy link
Copy Markdown
Contributor

Any final comments from Eric?

bors d=@eric-wieser

@mathlib-bors

mathlib-bors Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

✌️ eric-wieser can now approve this pull request until 2026-08-05 16:44 UTC (in 2 weeks). To approve and merge, reply with bors r+. More detailed instructions are available here.

⚠️ This delegation only covers changes within Archive/**, Counterexamples/**, docs/**, DownstreamTest/**, Mathlib/**, MathlibTest/**, widget/**, Archive.lean, Counterexamples.lean, docs.lean, Mathlib.lean; an author commit touching anything else will revoke it. Bors also revokes it if a later push changes too many files for it to check the full list — even if it stays within scope.

@mathlib-bors mathlib-bors Bot added the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Jul 22, 2026
@mathlib-triage mathlib-triage Bot removed the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Jul 22, 2026
@eric-wieser

Copy link
Copy Markdown
Member

I was hoping to look further at #39575 (comment) but haven't found the time yet.

@YaelDillies

Copy link
Copy Markdown
Contributor Author

I was hoping to look further at #39575 (comment)

I just resolved this comment, so hopefully Eric is happy with it now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). t-data Data (lists, quotients, numbers, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants